-- GENERATED SPELL FOR [Dragonmaw Elite] --


function spell0_22331(pUnit, Event) --@Aimed Shot,n/a--
pUnit:FullCastSpellOnTarget(38861,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_22331', 3000, 1)
end

function spell1_22331(pUnit, Event) --@Choose Target (50 yd),Self--
pUnit:FullCastSpellOnTarget(32121,pUnit)
pUnit:RegisterEvent('Sorts_22331', 671, 1)
end

function spell2_22331(pUnit, Event) --@Serpent Sting,n/a--
pUnit:FullCastSpellOnTarget(38859,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_22331', 15000, 1)
end

function spell3_22331(pUnit, Event) --@Shoot,n/a--
pUnit:FullCastSpellOnTarget(38858,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_22331', 610, 1)
end

function Sorts_22331(pUnit, Event)
local choix_sorts_22331 = math.random(0, 3)
if choix_sorts_22331 == 0 then
pUnit:RegisterEvent('spell0_22331', 1, 1)
end
if choix_sorts_22331 == 1 then
pUnit:RegisterEvent('spell1_22331', 1, 1)
end
if choix_sorts_22331 == 2 then
pUnit:RegisterEvent('spell2_22331', 1, 1)
end
if choix_sorts_22331 == 3 then
pUnit:RegisterEvent('spell3_22331', 1, 1)
end
end

function mob22331_Action(pUnit, Event)
pUnit:RegisterEvent('Sorts_22331', math.random(1500, 3000), 1)
end

function mob22331_Leave(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob22331_Kill(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob22331_Die(pUnit, Event)
pUnit:RemoveEvents();
end

RegisterUnitEvent(22331, 1, 'mob22331_Action')
RegisterUnitEvent(22331, 2, 'mob22331_Leave')
RegisterUnitEvent(22331, 3, 'mob22331_Kill')
RegisterUnitEvent(22331, 4, 'mob22331_Die')
